<template>
  <div>
    <van-goods-action>
      <van-goods-action-icon icon="chat-o" text="客服" color="#ee0a24" />
      <van-goods-action-icon icon="cart-o" text="购物车" @click="jumpTo"/>
      <van-goods-action-icon icon="star" text="已收藏" color="#ff5000" />
      <van-goods-action-button
        type="warning"
        text="加入购物车"
        @click="addCart"
      />
      <van-goods-action-button type="danger" text="立即购买" />
    </van-goods-action>
  </div>
</template>

<script>
import Vue from 'vue';
import { GoodsAction, GoodsActionIcon, GoodsActionButton , Toast } from 'vant';

import {addCart} from '../../apis/cart'

Vue.use(GoodsAction);
Vue.use(GoodsActionButton);
Vue.use(GoodsActionIcon);
Vue.use( Toast);
export default {
  name: "GoodsAction",

  data() {
    return {};
  },

  mounted() {},

  methods: {
  addCart(){
    addCart({userid:localStorage.getItem("userid"),proid:this.$route.params.proid,num:1}).then(data=>{
      Toast.success(data.data)
    })
  },
  jumpTo(){
    this.$router.push("/cart")
  }
  },
};
</script>

<style  scoped>
</style>